package cn.htsyb.synergy.security.web.model;

import cn.htsyb.synergy.security.entity.SecurityPermission;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.beans.BeanUtils;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.core.GrantedAuthority;

@Setter
@Getter
@NoArgsConstructor
public class SecurityAuthority extends SecurityPermission   implements GrantedAuthority, ConfigAttribute {
    private static final long serialVersionUID = 1L;

    public SecurityAuthority(SecurityPermission securityPermission) {
        BeanUtils.copyProperties(securityPermission, this);
    }

    @Override
    public String getAttribute() {
        return this.authCode;
    }

    @Override
    public String getAuthority() {
        return this.authCode;
    }
}
